"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TimerUtil = void 0;
const Logger_1 = require("./Logger");
const Config_1 = require("../../config/Config");
const EventManager_1 = require("./EventManager");
const DateUtil_1 = require("./DateUtil");
const LogClearManager_1 = require("../../../log_server/LogClearManager");
const ServerConfig_1 = require("../../config/ServerConfig");
const hall_server_TimerManager_1 = require("../../../hall_server/hall_server_TimerManager");
const TimerManager_1 = require("../../server/TimerManager");
const LogAddManager_1 = require("../../../log_server/LogAddManager");
const LogTest_1 = require("../../../log_server/LogTest");
class TimerUtil {
    static init() {
        setInterval(() => {
            try {
                let now = DateUtil_1.default.now();
                if (ServerConfig_1.ServerConfig.nowServerConfig) {
                    TimerManager_1.TimerManager.instance.checkTimer(now);
                    if (Config_1.Config.serverType == Config_1.Config.ServerType_List.log_server) {
                        LogTest_1.LogTest.instance.checkJoinServer(now);
                        LogClearManager_1.LogClearManager.instance.checkClear(now);
                        LogAddManager_1.LogAddManager.instance.checkDayLog(now);
                    }
                    else if (Config_1.Config.serverType == Config_1.Config.ServerType_List.hall_server) {
                        hall_server_TimerManager_1.hall_server_TimerManager.instance.checkTimer(now);
                    }
                    // else if (Config.serverType == Config.ServerType_List.huanghua_mj_server) {
                    //     huanghua_mj_TimerManager.instance.checkTimer(now)
                    // }
                    // else if (Config.serverType == Config.ServerType_List.ddz_server) {
                    //     ddz_TimerManager.instance.checkTimer(now);
                    // }
                    // else if (Config.serverType == Config.ServerType_List.jianziding_server) {
                    //     jianziding_TimerManager.instance.checkTimer(now);
                    // }
                    // else if (Config.serverType == Config.ServerType_List.cangxian_mj_server) {
                    //     cangxian_TimerManager.instance.checkTimer(now);
                    // }
                    // else if (Config.serverType == Config.ServerType_List.paodekuai_server) {
                    //     paodekuai_TimerManager.instance.checkTimer(now)
                    // }
                    // else if (Config.serverType == Config.ServerType_List.dazhonger_mj_server) {
                    //     dazhonger_mj_TimerManager.instance.checkTimer(now)
                    // }
                }
                EventManager_1.EventManager.instance.dispatch(Config_1.Config.Event_Config.Timer, now);
            }
            catch (error) {
                Logger_1.Logger.error("TimerUtil.error=-=", error);
            }
        }, 50);
    }
}
exports.TimerUtil = TimerUtil;
